package org.jeecg.modules.flower.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.modules.flower.entity.FlowerSettleAccounts;
import org.jeecg.modules.flower.mapper.FlowerSettleAccountsMapper;
import org.jeecg.modules.flower.service.IFlowerSettleAccountsService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 结账
 * @Author: jeecg-boot
 * @Date: 2022-09-27
 * @Version: V1.0
 */
@Service
public class FlowerSettleAccountsServiceImpl extends ServiceImpl<FlowerSettleAccountsMapper, FlowerSettleAccounts> implements IFlowerSettleAccountsService {


    //查询账期状态
    @Override
  public  boolean getAccountState(String accountNo) {
        boolean rest = true;
        LambdaQueryWrapper<FlowerSettleAccounts> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(FlowerSettleAccounts::getPeriod, accountNo);
        List<FlowerSettleAccounts> list = this.list(queryWrapper);
        if (list.size() > 0) {
            Integer state = list.get(0).getState();
            if (state.compareTo(1) == 0) {
                rest = false;
            }
        } else {
            rest = true;
        }
        return rest;
    }
}
